package forces;
import physicalObjects.Mass;
import simulation.Global;

/**
 * 
 * @author Bruce Fu
 *
 */
public class WallRepulsion extends Force{
    /**
     * Calculate the wall repulsion forces from all four sides of walls
     */
    public WallRepulsion(){
        super(0,0);
    }
    
    public void setWallRepulsion(Mass myMass){
        Force top = new Force (90, 0);
        Force right = new Force (180, 0);
        Force bottom = new Force (-90, 0);
        Force left = new Force (0, 0);
        
        top.setMagnitude(Global.getWallTopMagnitude() / Math.pow(myMass.getTop(), Global.getWallTopExponent()));
        right.setMagnitude(Global.getWallRightMagnitude() / Math.pow(myMass.getRight(), Global.getWallRightExponent()));
        bottom.setMagnitude(Global.getWallBottomMagnitude() / Math.pow(myMass.getBottom(), Global.getWallBottomExponent()));
        left.setMagnitude(Global.getWallLeftMagnitude() / Math.pow(myMass.getLeft(), Global.getWallLeftExponent()));
        
        this.sum(top);
        this.sum(right);
        this.sum(bottom);
        this.sum(left);
    }
}
